package edu.isquen.core.role.action;

import edu.isquen.core.base.action.BaseAction;
import edu.isquen.core.role.model.Role;
import edu.isquen.core.role.service.RoleService;
import edu.isquen.util.factory.ServiceFactory;

public class RoleAction extends BaseAction<Role> {

	private static final long serialVersionUID = 1124583842206861263L;
	
	public RoleAction() throws Exception {
		super(ServiceFactory.createProcess(RoleService.class), new Role());
	}

	@Override
	public String doSave() {
		Role role=(Role) this.getValObj();
		if(role!=null){
			try {
				((RoleService) service).doSaveOrUpdate(role);
				this.addActionMessage("保存成功");
			} catch (Exception e) {
				this.addActionMessage("Exception: "+e.getMessage());
				return INPUT;
			}
		}
		return SUCCESS;
	}
}
